package model;

public class CalculateNextOpportunityStateStrategy implements CalculateNextStateStrategy{
	public SMSObjectState getNextState(SMSObject smsObject, RuleSelector ruleSelector) {
		
		boolean status = ruleSelector.processRuleRequest();
		System.out.println("Rule: "+ ruleSelector.getRule().getRuleDescripton());
		SMSObjectState currentState = smsObject.getCurrentState();
		if (status == true) {
			
			
			if (currentState instanceof Qualified) {
				return new Imported();
			} else if (currentState instanceof Imported) {
				return new Prepared();
				
			} 
			else if (currentState instanceof Prepared) {
				return new Quoted();
				
			} else if (currentState instanceof Quoted) {
				return new Approved();
			} 
		}else{
			if (currentState instanceof Quoted) {
				return new Imported();
		}
		
	}
		return smsObject.getCurrentState();
  }
}
